<fieldset>
    <legend>Customer List</legend>
    <table class="data">
        <thead>
            <tr>
                <th width="50px"><?php echo 'No'; ?></th>
                <th width="100px"><?php echo 'Customer no.'; ?></th>
                <th><?php echo 'Customer Name'; ?></th>
                <th><?php echo 'มีคลังอยู่ที่ลูกค้า'; ?></th>
                <th><?php echo 'มีคลังอยู่ที่ Vendor'; ?></th>
                <th width="50px">&nbsp;</th>
            </tr>
        </thead>
        <tbody>
            <?php if (empty($this->data)) : // ถ้าไม่มีข้อมูล ?>
                <tr>
                    <td colspan="6"><div class="fail-flash">Vendor นี้ยังไม่มีลูกค้าที่สามารถดูได้</div></td>
                </tr>
            <? else : // ถ้ามีข้อมูล ?>
                <?php $i = 0;
                foreach ($this->data as $CS): ?>
                    <?php
                    $tableCell = array();
                    $tableCell[] = ++$i;
                    $tableCell[] = $CS['Customer']['cust_no'];
                    $tableCell[] = $CS['Customer']['name'];
                    $tableCell[] = $CS['CustomerSupplier']['has_cust_inventory'] ? 'Yes' : 'No';
                    $tableCell[] = $CS['CustomerSupplier']['has_supplier_inventory'] ? 'Yes' : 'No';
                    $tableCell[] = $ajax->link(
                                    $html->image('icon/edit.png', array('title' => 'edit', 'alt' => 'edit')), "view_customer/{$CS['CustomerSupplier']['supplier_id']}/{$CS['CustomerSupplier']['id']}", array('update' => 'divCustomer', 'indicator' => 'indicator'), null, false)
                            . '&nbsp;' .
                            $my->confirmLink($html->image('icon/delete.png', array('title' => 'delete', 'alt' => 'delete')), "{$this->name}/delete_customer/{$CS['CustomerSupplier']['id']}", 'Do you want to remove \"' . $CS['Customer']['name'] . '\" from Customer contract list?', 'divCustomerSupplier', false);
                    echo $html->tableCells($tableCell, array('class' => 'odd-cell'), array('class' => 'even-cell'));
                    ?>
                <?php endforeach; ?>
            <?php endif; ?>
        </tbody>
    </table>
    <div id="divCustomer">
        <?php echo $this->requestAction('suppliers/view_customer/' . $supplier_id, array('return')); ?>
    </div>
</fieldset>